#ifndef AVALON_MOCKCONNECTION_HPP
#define AVALON_MOCKCONNECTION_HPP
#include <boost/thread/mutex.hpp>
#include "Avalon/IO/Connection.hpp"
#include "Avalon/IOTests/IOTests.hpp"

namespace Avalon {
namespace IO {
namespace Tests {

  /** \class MockConnection
   *  \brief Implements Connection for testing/mock purposes.
   */
  class MockConnection : public Connection {
    public:

      //! Constructs a MockConnection.
      MockConnection();

      virtual ~MockConnection();

      //! Sets this MockConnection as open.
      void SetOpen();

      virtual bool IsOpen() const;

      virtual void Close();

      virtual void SetClosedSlot(const ClosedSlot& slot, Out<bool> isOpen);

    private:
      mutable boost::mutex m_mutex;
      bool m_isOpen;
      boost::shared_ptr<ClosedSlot> m_closedSlot;
  };
}
}
}

#endif // AVALON_MOCKCONNECTION_HPP
